//app.js
App({
  data: {
  },
  onLaunch: function () {
    // 展示本地存储能力
    var logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)
    var that=this
    // 获取用户信息
    
    // 登录
    wx.login({
      success: res => {
        var code = res.code
        var appid = 'wx977e17f03ca895e3'
        var secret = '3982d5e2a74214555c226d5d1a910b8d'
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
        that.globalData.data = {
          APPID: appid,
          APPSECRET: secret,
          Code: code,
          granttype: 'authorization_code'
        }
      }
    })   
    
  },
  globalData: {
    userInfo: null,
    openid:null,
    indexs:0,
    correct:0,
    wrong:0,
    score:0,
    corrects:0,
    wrongs:0,
    lever:"",
    data:{}
  }
})